#include "syscall.h"
#include "print.c"

/*********************************************************
  
    Test 1 : use lock syscall in right order
    (Does not use Wait() and Signal() because this test 
    only run one process, will have other test for that)

**********************************************************/

int main()
{
    int lock;    
    int lockCV;
    int printMsg[1];

    printString("-------------- Starting Test 1 --------------\n");

    lock = CreateLock();
    printMsg[0] = lock;
    printf("-> lock %d has been created.\n", printMsg);

    lockCV = CreateCondition();
    printMsg[0] = lockCV;
    printf("-> Condition %d has been created.\n", printMsg);

    Acquire(lock);
    printf("-> Acquire Lock %d\n", printMsg);

    DestroyCondition(lockCV);
    printMsg[0] = lockCV;
    printf("-> Destroy Condition %d\n", printMsg);    
    
    Release(lock);
    printMsg[0] = lock;
    printf("-> Release Lock %d\n", printMsg);

    DestroyLock(lock);
    printMsg[0] = lock;
    printf("-> Destroy Lock %d\n", printMsg);    

    printString("----------------- Test 1 End -----------------\n");

    Exit(0);
}




